<extend name="Member:base" />
<block name="title"><title>心心向善-换货申请</title></block>
		<!-- 头部结束-->
<block name="body">
<!-- 上传插件 -->
<script type="text/javascript" src='__PUBLIC__/Uploadify/jquery-1.7.2.min.js'></script>
<link rel="stylesheet" href="__PUBLIC__/Uploadify/uploadify.css"/>
<script type="text/javascript" src='__PUBLIC__/Uploadify/jquery.uploadify.min.js'></script>
<script type='text/javascript'>
    
        var PUBLIC = '__PUBLIC__';
        var uploadUrl = '{:U("Common/uploadFace")}';
        var ROOT = '__ROOT__';
        // alert(PUBLIC);
        // alert(uploadUrl);
        // alert(ROOT);
</script>

<script type="text/javascript">
 //上传插件
$(function() {
 
 $('#face').uploadify({
        swf : PUBLIC + '/Uploadify/uploadify.swf',  //引入Uploadify核心Flash文件
        uploader : uploadUrl,   //PHP处理脚本地址
        // width : 120,    //上传按钮宽度
        width : 95,    //上传按钮宽度
        height : 30,    //上传按钮高度
        // buttonImage : PUBLIC + '/Uploadify/browse-btn.png', //上传按钮背景图地址
        buttonImage : PUBLIC + '/Uploadify/browse-btn_02.png', //上传按钮背景图地址
        fileTypeDesc : 'Image File',    //选择文件提示文字
        fileTypeExts : '*.jpeg; *.jpg; *.png; *.gif',   //允许选择的文件类型
//      formData : {'session_id' : sid},
        //上传成功后的回调函数
        onUploadSuccess : function (file, data, response) {
            // alert(data);
            eval('var data = ' + data);
            if (data.status) {
                $('#face-img').attr('src', ROOT + '/Uploads/' + data.path);
                $('input[name=face180]').val('/Uploads/'+data.path);
            } else {
                alert(data.msg);
            }
        }
    });
 
 
 });
 </script>
 <style>
 .uploadify-button {
    border-radius: 0px;
    border: 0px solid #808080;
}
 </style>

			<!--<主要区块>-->
			<div class="right-layout">
				<div class="wrap">
					<div class="tabmenu">




						<ul class="tab pngFix">
							<li class="normal">
								<a href="/member/swjydd.html">订单列表</a>
							</li>
							<li class="active">
								<a href="#">申请换货</a>
							</li>
						</ul>
					</div>
					<div class="alert alert-success">
						<h4>操作提示：</h4>
						<ul>
							<li>1. 换货需先提交换货申请，经商家审核通过后才能换货成功。</li>
						</ul>
					</div>
					<form id="form_avaster" action="th" method="post" >
					<input type="hidden" name="form_submit" value="ok">
					<input type="hidden" name="id" value="{$tkid}">
					<input type="hidden" name="qb" value="{$qb}">
					<div class="ncm-default-form">
						
							<dl>
								<dt><i class="required"></i>订单号：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list2.order_sn}" name="order_sn" id="order_sn" readonly>
								</dd>
							</dl>
							<dl>
								<dt><i class="required"></i>商铺名称：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list2.store_name}" name="store_name" id="store_name" readonly>
								</dd>
							</dl>

                            <if condition="$qb eq 'qb'" >
                            <dl>
								<dt><i class="required"></i>退款说明：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="订单商品全部退款" name="product_name" id="product_name" readonly>
								</dd>
							</dl>
							<dl>
								<dt><i class="required"></i>退款金额：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list2.order_amount}" name="tk_price" id="tk_price" readonly>
								</dd>
							</dl>
                            <else/>
							<dl>
								<dt><i class="required"></i>商品图片：</dt>
								<dd>
								    <img src="{$list.goods_image}" >
									<input type="hidden" class="text w180" maxlength="40" value="{$list.goods_image}" name="goods_image" id="goods_image">
								</dd>
							</dl>
							<dl>
								<dt><i class="required"></i>商品名称：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list.goods_name}" name="goods_name" id="goods_name" readonly>
								</dd>
							</dl>
							<dl>
								<dt><i class="required"></i>商品单价：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list.goods_price}" name="goods_price" id="goods_price" readonly>
								</dd>
							</dl>
							<dl>
								<dt><i class="required"></i>商品数量：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list.goods_num}" name="goods_num" id="goods_num" >
									<input type="hidden" name="num" id="num" value="{$list.goods_num}">
								</dd>
							</dl>
							<!-- <dl>
								<dt><i class="required"></i>商品金额：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="<?php echo $list['goods_price']*$list['goods_num']?>" name="tk_price" id="tk_price" readonly>
								</dd>
							</dl> -->
                            </if>

							<dl>
								<dt><i class="required"></i>换货原因：</dt>
								<dd>
									<textarea rows="" cols="" name="tkyy" style="width: 180px;"></textarea>
								</dd>
							</dl>
							<dl class="edit-face">
								<dt><i class="required"></i>上传凭证：</dt>
								<dd>
									<img src="" style="background-color: #fafafa;width: 180px;height:140px;margin-bottom:20px;" id='face-img'/>
								    <input type="file" name='face' id='face'/>
								    <input type="hidden" name='face180' value=''/>
								</dd>
							</dl>
							<!-- <dl>
								<dt><i class="required">*</i>商品单价：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list.goods_price}" name="member_password" id="member_password">
								</dd>
							</dl>
							<dl>
								<dt><i class="required">*</i>商品数量：</dt>
								<dd>
									<input type="text" class="text w180" maxlength="40" value="{$list.goods_num}" name="member_password" id="member_password">
								</dd>
							</dl> -->
							
							<dl class="bottom">
								<dt>&nbsp;</dt>
								<dd><label class="submit-border">
						  <input type="hidden" name="tkhash" id="tkhash" value="">
				          <input type="submit" class="submit" value="提交"></label>
								</dd>
							</dl>
						
					</div>
				    </form>
				</div>
			</div>
			<!--</主要区块>-->
			<div class="clear"></div>
		</div>
	<script type="text/javascript">
	$(function(){

		$('#goods_num').change(function(){

			if ($.trim($('#goods_num').val()) == '')
            {
                alert('要换货的商品数量不能为0！');
                $('#goods_num').focus();
                return false;

            }
            if ($.trim($('#goods_num').val()) > $.trim($('#num').val()))
            {
                alert('要换货的商品数量不能超过原来的数量！');
                $('#goods_num').focus();
                return false;

            }
					
			
					
		});

		$('#face').change(function(){
					
			$("#tkhash").val(_getRandomString(32));
					
		});

		$('input').change(function(){
			$("#tkhash").val(_getRandomString(32));

		});
		$('textarea').change(function(){
			$("#tkhash").val(_getRandomString(32));
		});
	});
	

	// 获取长度为len的随机字符串  
	function _getRandomString(len) {  
		len = len || 32;  
		var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; // 默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1  
		var maxPos = $chars.length;  
		var pwd = '';  
		for (i = 0; i < len; i++) {  
			pwd += $chars.charAt(Math.floor(Math.random() * maxPos));  
		}  
		return pwd;  
	} 
  </script>
	</block>